import { axiosPost } from '@/libs/http';

export function getDayData (date) {
  return new Promise((resolve, reject) => {
    axiosPost({
      url: '/api/calendar/day',
      data: {
        date
      },
      success (data) {
        resolve(data)
      },
      fail (err) {
        reject(err);
      }
    })
  })
}

export function getMonthData (yearMonth) {
  return new Promise((resolve, reject) => {
    axiosPost({
      url: '/api/calendar/month',
      data: {
        'year-month': yearMonth
      },
      success (data) {
        resolve(data)
      },
      fail (err) {
        reject(err);
      }
    })
  })
}


export function getYearData (year) {
  return new Promise((resolve, reject) => {
    axiosPost({
      url: '/api/calendar/year',
      data: {
        year
      },
      success (data) {
        resolve(data)
      },
      fail (err) {
        reject(err);
      }
    })
  })
}